// 一些用到的公共方法
export const copy = (source: any) => {
  var sourceCopy = source instanceof Array ? [] : {};
  for (var item in source) {
      (sourceCopy as any)[item] = typeof source[item] === 'object' ? copy(source[item]) : source[item];
  }
  return sourceCopy;
}

export const isMobile = () => {
  return !(navigator.userAgent.match(
      /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
    ) === null)
}

export const isWechat = () => {
  return navigator.userAgent.indexOf('MicroMessenger') > -1 ? true : false;
}

export const sourceIp2 = () => {
  let imgUrl = useRuntimeConfig().public.sourceIp2
  return `${imgUrl}/uploads/`;
}